$(document).ready(function(){
    $("#denglu").click(function(){
        var password=$("#password").val();
        var name=$("#username").val();
        if(name==null||name==""||password==null||password==""){
            alert("用户名或密码没有填写!");
            return;
        }
        $.ajax({
            type : "POST",
            url : "http://140.143.18.230:8081/usercenter/user/checkLogin",
            dataType : "json",
            data : {
                password:password,
                name:name
            },
            success : function(data) {
                console.log(data);
                if("no"==data.result){
                    alert("未查询到用户信息!");
                    return;
                }
                if("wrong secret"==data.result){
                    alert("密码错误!");
                    return;
                }
                if("student"==data.result){
                    window.location.href = "Smain";
                    return;
                }
                if("teacher"==data.result){
                    window.location.href = "Tmain";
                    return;
                }
                if("manager"==data.result){
                    window.location.href = "daily.html";
                }
            },
            error : function(xhr,textStatus) {
                console.log('错误');
                console.log(xhr);
                console.log(textStatus);
            }
        });
    });
    })